package com.smartwebx.ha.dal.realtime.dao;

import java.util.Date;
import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;

import com.smartwebx.ha.dal.config.OracleConfigInfo;
import com.smartwebx.ha.dal.inter.water.IZProcessDataOperatDao;
import com.smartwebx.ha.dal.realtime.sqlprovider.GrwProvider;
import com.smartwebx.ha.dal.usebean.DateValue;
import com.smartwebx.ha.dal.usebean.GisWater;

/**
 * 地下水
 * 
 * @author zhangxi
 * 
 */
public interface GrwMapper extends IZProcessDataOperatDao {

	String ST_GRW_R = OracleConfigInfo.REALTIME_NAME + ".ST_GRW_R";

	@SelectProvider(type = GrwProvider.class, method = "getAllStatGroundWaterSQL")
	public List<GisWater> getAllStatGroundWaterStcdFilter(
			@Param("datePoint") Date datePoint);

	@Select("SELECT TM,GWBD val FROM "
			+ ST_GRW_R
			+ " WHERE STCD=#{stcd} AND TM>=#{startDate} AND TM<#{endDate} AND to_char(TM,'HH24')")
	public List<DateValue> getSingleStatDayZProcess(@Param("stcd") String stcd,
			@Param("startDate") Date startDate, @Param("endDate") Date endDate);

	@Select("SELECT TM,GWBD val FROM "
			+ ST_GRW_R
			+ " WHERE STCD=#{stcd} AND TM<#{datePoint} AND ROWNUM=1 ORDER BY TM DESC")
	public DateValue getStartHourBeforeZVal(@Param("stcd") String stcd,
			@Param("datePoint") Date startHour);

	@Select("SELECT TM,GWBD val FROM " + ST_GRW_R
			+ " WHERE STCD=#{stcd} AND TM>=#{startHour} AND TM<#{endHour}")
	public List<DateValue> getSingleStatHourZProcess(
			@Param("stcd") String stcd, @Param("startHour") Date startHour,
			@Param("endHour") Date endHour);
}
